<template>
  <div class="app-container home">
    <AdminIndex :user="user"></AdminIndex>
  </div>
</template>

<script>
import { getUserProfile } from '@/api/system/user'
import { getAgentUserId } from '@/api/ecs/agent'
import AdminIndex from "@/layout/components/index/admin.vue"

export default {
  name: "Index",
  components:{
    AdminIndex
  },
  data() {
    return {
      user:{},
    };
  },
  mounted() {
    getUserProfile().then(response => {
      this.user = response.data;
      this.user.avatar = process.env.VUE_APP_BASE_API + response.data.avatar
      if (this.user.deptId === 101){
        getAgentUserId(this.user.userId).then(response => {
          if(response.data.agentId !== 0){
            this.user.deptId = 102
          }
        });
      }
    });
  },
  methods: {
  }
};
</script>

<style scoped lang="scss">
.app-container {
  height: 100%;
  box-sizing: border-box;
  padding: 10px 8px 10px;
}
</style>

